package org.apache.http.message;

import org.apache.http.HeaderElement;
import org.apache.http.NameValuePair;
import org.apache.http.a.a;
import org.apache.http.a.f;
import org.apache.http.annotation.NotThreadSafe;

@NotThreadSafe
public class c implements Cloneable, HeaderElement {
    private final String a;
    private final String b;
    private final NameValuePair[] c;

    public c(String str, String str2, NameValuePair[] nameValuePairArr) {
        this.a = (String) a.a((Object) str, "Name");
        this.b = str2;
        if (nameValuePairArr != null) {
            this.c = nameValuePairArr;
        } else {
            this.c = new NameValuePair[0];
        }
    }

    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof HeaderElement)) {
            return false;
        }
        c cVar = (c) obj;
        return this.a.equals(cVar.a) && f.a(this.b, cVar.b) && f.a(this.c, cVar.c);
    }

    public String getName() {
        return this.a;
    }

    public NameValuePair getParameter(int i) {
        return this.c[i];
    }

    public NameValuePair getParameterByName(String str) {
        a.a((Object) str, "Name");
        for (NameValuePair nameValuePair : this.c) {
            if (nameValuePair.getName().equalsIgnoreCase(str)) {
                return nameValuePair;
            }
        }
        return null;
    }

    public int getParameterCount() {
        return this.c.length;
    }

    public NameValuePair[] getParameters() {
        return (NameValuePair[]) this.c.clone();
    }

    public String getValue() {
        return this.b;
    }

    public int hashCode() {
        int a = f.a(f.a(17, this.a), this.b);
        for (Object a2 : this.c) {
            a = f.a(a, a2);
        }
        return a;
    }

    public String toString() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(this.a);
        if (this.b != null) {
            stringBuilder.append("=");
            stringBuilder.append(this.b);
        }
        for (Object obj : this.c) {
            stringBuilder.append("; ");
            stringBuilder.append(obj);
        }
        return stringBuilder.toString();
    }
}
